package com.woniu.cms.contract.core.controller;


import com.woniu.cms.contract.core.entity.UndertakeContractManagement;
import com.woniu.cms.contract.core.service.IUndertakeContractManagementService;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author maple leaf
 * @since 2022-09-17
 */
@Api(tags = "承接合同")
@RestController
@RequestMapping("/undertake-contract")
public class UndertakeContractController {

    @Autowired
    private IUndertakeContractManagementService undertakeContractManagementService;

    @ApiOperation("新增")
    @PostMapping
    public Result addUnderMen(@RequestBody UndertakeContractManagement undertakeContractManagement){
        Result result = undertakeContractManagementService.addUnderMen(undertakeContractManagement);
        return result;

    }

    @ApiOperation("删除")
    @DeleteMapping("{undertakeContractCode}")
    public Result delUnderMen(@PathVariable String undertakeContractCode){
        Result result = undertakeContractManagementService.delUnderMen(undertakeContractCode);
        return result;


    }
    @ApiOperation("查询单条")
    @GetMapping("{undertakeContractCode}")
    public Result queryByUnderMen(@PathVariable String undertakeContractCode){

        Result result = undertakeContractManagementService.queryByUnderMen(undertakeContractCode);
        return result;


    }
    @ApiOperation("修改")
    @PutMapping
    public Result updaUnderMen(@RequestBody UndertakeContractManagement undertakeContractManagement){

        Result result = undertakeContractManagementService.updaUnderMen(undertakeContractManagement);
        return result;


    }
    @ApiOperation("分页与条件查询")
    @GetMapping
    public Result queryUnderMen(String undertakeContractCode,Integer currentPage,Integer pageSize){

        Result result = undertakeContractManagementService.queryUnderMen(undertakeContractCode, currentPage, pageSize);
        return result;

    }


}

